<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">母托编码</label>
        <el-input v-model.trim="query.parentPalletCode" clearable placeholder="母托编码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" @clear="crud.toQuery" />
        <label class="el-form-item-label">产品编号</label>
        <el-input v-model.trim="query.productNo" clearable placeholder="产品编号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" @clear="crud.toQuery" />
        <label class="el-form-item-label">标签号</label>
        <el-input v-model.trim="query.serialNo" clearable placeholder="标签号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" @clear="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <!-- <el-table-column type="selection" width="55" /> -->
        <el-table-column prop="productOutBoundOrderNo" label="出库单ID" />
        <el-table-column prop="productOutBoundOrderDetailNo" label="出库单详情ID" />
        <el-table-column prop="productOutBoundOrderTaskNo" label="出库任务ID" />
        <el-table-column prop="finishTime" label="任务完成时间" />
        <el-table-column prop="parentPalletCode" label="母托编码" />
        <el-table-column prop="productNo" label="产品编号" />
        <el-table-column prop="partnerProductNo" label="客户物料编码" />
        <el-table-column prop="qty" label="数量" />
        <el-table-column prop="serialNo" label="标签号" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column prop="updateTime" label="更新时间" />
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudProductOutBoundTaskDetailHistory from '@/api/work/productOutboundMissionDetailHistory'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
// import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, productOutBoundOrderNo: null, productOutBoundOrderDetailNo: null, productOutBoundOrderTaskNo: null, finishTime: null, parentPalletCode: null, productNo: null, partnerProductNo: null, qty: null, serialNo: null, createTime: null, updateTime: null, createName: null, updateName: null }
export default {
  name: 'ProductOutboundMissionDetailHistory',
  components: { pagination, crudOperation, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '1', url: 'api/productOutBoundTaskDetailHistory', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProductOutBoundTaskDetailHistory },
      optShow: {
        reset: true,
        add: false,
        del: false,
        edit: false,
        download: true
      }
    })
  },
  data() {
    return {
      permission: {
        add: ['admin', 'productOutBoundTaskDetailHistory:add', 'otherUser'],
        edit: ['admin', 'productOutBoundTaskDetailHistory:edit', 'otherUser'],
        del: ['admin', 'productOutBoundTaskDetailHistory:del', 'otherUser']
      },
      rules: {
      }
    }
  },
  // created() {
  // },
  // mounted() {
  //   this.crud.toQuery()
  // },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      this.query.productOutBoundOrderTaskNo = this.$route.query.id
      return true
    }
  }
}
</script>

<style scoped>

</style>
